package com.java.miaosha.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.java.miaosha.dao.MiaoshaOrderDao;
import com.java.miaosha.entity.MiaoshaOrderEntity;
import com.java.miaosha.service.MiaoshaOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service("miaoshaOrderService")
public class MiaoshaOrderServiceImpl extends ServiceImpl<MiaoshaOrderDao, MiaoshaOrderEntity> implements MiaoshaOrderService {
	@Autowired
	private MiaoshaOrderDao miaoshaOrderDao;

	@Override
	public MiaoshaOrderEntity getByUserIdAndGoodsId(Long userId, Long goodsId) {
		return miaoshaOrderDao.selectOne(new LambdaQueryWrapper<MiaoshaOrderEntity>().eq(MiaoshaOrderEntity::getUserId,userId)
										.eq(MiaoshaOrderEntity::getGoddsId,goodsId));
	}
}